
from Base.Base import Base
from selenium.webdriver.common.by import By

class Page1(Base):
    # 点击文本登录按钮
    login = (By.LINK_TEXT, '请登录')
    # 输入账号
    username = (By.XPATH, '//input[@id="userName" or name="uname"]')
    # 输入密码
    password = (By.NAME, "_pwd")
    # 设置强制等待时间
    # 点击登录按钮
    sbumit_log = (By.XPATH, '//*[@id="save"]')
    # 点击确认
    quer_loc = (By.ID, 'bindSub')
    # 在搜索框输入商品名称
    sousuo_loc = (By.NAME, 'key')
    # 点击搜索按钮
    sousuo_sbumit = (By.CLASS_NAME, 'search-btn')

    def login1(self):
        # 点击登录
        self.click(self.login)
        # 输入账号
        self.send_keys(self.username, '18696472858')
        # 输入密码
        self.send_keys(self.password, '123456Aa')
        # 强制等待时间
        self.sleep(10)
        # 点击登录按钮
        self.click(self.sbumit_log)
        # 点击确认按钮
        self.click(self.quer_loc)

    #参数化驱动
    def goods_loc(self,goods):
        self.send_keys(self.sousuo_sbumit,goods)
